/* 全局样式 */
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-color);
  background: linear-gradient(120deg, #f0f2f5 0%, #e5e7eb 100%);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.03) 0%, transparent 70%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.03) 0%, transparent 70%);
  height: 100%;
}

.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.content-area {
  display: flex;
  flex: 1;
  gap: 24px;
  padding: 0 var(--spacing-lg) var(--spacing-lg) var(--spacing-lg);
  height: 0;
  min-height: 0;
  overflow: hidden;
}

#header {
  padding: var(--spacing-md) 0;
  background-color: transparent;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

#character-panel,
#settings-panel,
#chat-area {
  height: calc(100vh - var(--header-height) - var(--nav-height) - var(--spacing-lg));
  max-height: calc(100vh - var(--header-height) - var(--nav-height) - var(--spacing-lg));
  min-height: calc(100vh - var(--header-height) - var(--nav-height) - var(--spacing-lg));
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: var(--spacing-md);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all var(--transition-normal) ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

#character-panel {
  width: 280px;
}

#settings-panel {
  width: 320px;
  margin: 0 var(--spacing-lg);
  position: relative;
  transition: width 0.3s ease;
}

#settings-panel.collapsed {
  width: 60px;
}

#settings-panel.collapsed .settings-content {
  opacity: 0;
  pointer-events: none;
}

.settings-toggle-button {
  position: absolute;
  top: var(--spacing-md);
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--background-light-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast) ease;
}

.settings-toggle-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.settings-toggle-button.collapsed {
  right: -8px;
}

#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.7);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 0;
}

.settings-section {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: var(--spacing-md);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-normal) ease;
  position: relative;
  overflow: hidden;
}

.settings-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 16px 16px 0 0;
}

.settings-section:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.settings-section h3 {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-color);
  font-size: 15px;
  font-weight: 600;
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.settings-section h3::before {
  content: '';
  display: block;
  width: 4px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
  margin-right: 8px;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  position: relative;
  padding: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.settings-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.settings-section input,
.settings-section textarea,
.settings-section select {
  padding: 10px 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  transition: all var(--transition-normal) ease;
  width: 100%;
  color: var(--text-color);
}

.settings-section input:hover,
.settings-section textarea:hover,
.settings-section select:hover {
  border-color: rgba(79, 70, 229, 0.3);
  background: #ffffff;
}

.settings-section input:focus,
.settings-section textarea:focus,
.settings-section select:focus {
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.settings-section button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  transition: all var(--transition-normal) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.settings-section button:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.settings-section button:active {
  transform: translateY(0);
}

.settings-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.06), transparent);
  margin: var(--spacing-md) 0;
}

#character-panel::-webkit-scrollbar,
#settings-panel::-webkit-scrollbar {
  width: 4px;
}

#character-panel::-webkit-scrollbar-thumb,
#settings-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.main-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--spacing-lg);
}

/* 选项卡样式 */
.tab-container {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  font-weight: 500;
  transition: all var(--transition-normal) ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  opacity: 0.7;
}

.tab-button.active {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: var(--primary-color);
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.tab-button.inactive {
  opacity: 0.5;
  background-color: rgba(255, 255, 255, 0.5);
}

.tab-button:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.9);
}

/* 通用样式 */
button {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  font-weight: 500;
  transition: all var(--transition-normal) ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

button:hover {
  background-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

button:active {
  transform: translateY(0);
}

input, textarea, select {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background-color: rgba(255, 255, 255, 0.5);
  transition: all var(--transition-normal) ease;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* 添加响应式设计 */
@media (max-width: 1400px) {
  .content-area {
    gap: var(--spacing-md);
  }
  
  #character-panel {
    width: 260px;
  }
  
  #settings-panel {
    width: 300px;
    margin: 0 var(--spacing-md);
  }
  
  .settings-section {
    padding: var(--spacing-sm);
  }
  
  .settings-toggle-button {
    right: -10px;
  }
}

@media (max-width: 1200px) {
  .main-layout {
    padding: 0 var(--spacing-sm);
  }
  
  .content-area {
    padding: var(--spacing-md) 0;
    gap: var(--spacing-sm);
  }
  
  #character-panel {
    width: 240px;
  }
  
  #settings-panel {
    width: 280px;
    margin: 0 var(--spacing-sm);
  }
  
  .settings-toggle-button {
    right: -8px;
  }
}

@media (max-width: 768px) {
  .content-area {
    flex-direction: column;
    padding: var(--spacing-sm) 0;
    gap: var(--spacing-sm);
  }
  
  #character-panel,
  #settings-panel,
  #chat-area {
    width: 100%;
    height: auto;
    max-height: calc(50vh - var(--header-height) - var(--nav-height) - var(--spacing-lg));
    margin: 0;
  }
  
  .main-layout {
    padding: 0 var(--spacing-xs);
  }
  
  .settings-toggle-button {
    right: -6px;
    top: var(--spacing-sm);
  }
  
  #settings-panel.collapsed {
    width: 40px;
  }
}

/* 新增：聊天消息列表容器 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-lg);
  scroll-behavior: smooth;
}

/* 新增：聊天输入区域 */
.chat-input-area {
  flex-shrink: 0;
  padding: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
